<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />

<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="${contextPath}images/mobile/apple-touch-icon.png" />
<link rel="apple-touch-startup-image" href="${contextPath}images/mobile/apple-touch-startup-image-320x460.png" />
<meta name="author" content="FamousThemes" />
<meta name="description" content="GoMobile - A next generation web app theme" />
<meta name="keywords" content="mobile web app, mobile template, mobile design, mobile app design, mobile app theme, mobile wordpress theme, my mobile app" />

<title>GoMobile - A next generation web app theme</title>
<link type="text/css" rel="stylesheet" href="${contextPath}css/mobile/style.css" />
<link type="text/css" rel="stylesheet" href="${contextPath}css/mobile/colors/green/green.css" />
<link type="text/css" rel="stylesheet" href="${contextPath}css/mobile/idangerous.swiper.css" />
<link type="text/css" rel="stylesheet" href="${contextPath}css/mobile/swipebox.css" />
<script type="text/javascript" src="${contextPath}js/mobile/jquery-1.10.1.min.js"></script>
<script src="${contextPath}js/jquery.cookie.js"></script>
<script src="${contextPath}js/jquery-migrate-1.1.1.min.js"></script>
<script src="${contextPath}js/basic.js"></script>
<style type="text/css">
.loginLogo a {
	display: inline-block;
	width: 200px;
	height: 200px;
	line-height: 200px;
	-moz-border-radius: 202px;
	-webkit-border-radius: 202px;
	border-radius: 202px;
	background: #999;
	background: url(${contextPath}images/mobile/logo_bg.jpg) center;
	border: 4px solid #2dcc70;
	font-size: 72px;
	color: #2dcc70;
}
</style>
</head>

<body>

	<div class="loginLogo">
		<a href="#">
			<img src="${contextPath}images/mobile/lunarpixel_logo.png" alt="" title="" border="0" /> 
		</a>
	</div>
	<div class="loginForm">
		<form id="focus">
			<div class="loginEntry">
				<label><span>用户名</span><input name="email" id="email" type="text" class="loginInput" value="" /> </label>
				 <label><span>密码</span><input name="pwd" id="pwd" type="password" class="loginInput" value="" />
				</label>
				<p>
					<a href="javascript:;" id="loginBtn">登 录</a>
				</p>
			</div>

		</form>
	</div>
</body>
<script type="text/javascript">
	$(document).ready(
	function() {
		var email = $.cookie('email');
		var pwd = $.cookie('pwd');
		if (null != email)
			$('#email').val(email);
		if (null != pwd)
			$('#pwd').val(pwd);

		$("#focus .loginInput").each(function() {
			var thisVal = $(this).val();
			//判断文本框的值是否为空，有值的情况就隐藏提示语，没有值就显示
			if (thisVal != "") {
				$(this).siblings("span").hide();
			} else {
				$(this).siblings("span").show();
			}

			//聚焦型输入框验证 
			$(this).focus(function() {
				$(this).siblings("span").hide();
			}).blur(function() {
				var val = $(this).val();
				if (val != "") {
					$(this).siblings("span").hide();
				} else {
					$(this).siblings("span").show();
				}
			});
		});
		
		$("#keydown .loginInput").each(function() {
			var thisVal = $(this).val();
			//判断文本框的值是否为空，有值的情况就隐藏提示语，没有值就显示
			if (thisVal != "") {
				$(this).siblings("span").hide();
			} else {
				$(this).siblings("span").show();
			}
			$(this).keyup(function() {
				var val = $(this).val();
				$(this).siblings("span").hide();
			}).blur(function() {
				var val = $(this).val();
				if (val != "") {
					$(this).siblings("span").hide();
				} else {
					$(this).siblings("span").show();
				}
			});
		});

		$('#loginBtn').click(function() {
			var email = $('#email');
			var pwd = $('#pwd');

			if (email.val() == '' || pwd.val() == '') {
				if (!$.browser.msie) {
					$('.loginwrap').addClass('animate0 wobble').bind(anievent,
						function() {
							$(this).removeClass('animate0 wobble');
						});
				}
			} else {
				login(email.val(), pwd.val());
			}
		});

		function login(email, pwd) {
			var url = '${contextPath}bsLogin2.html?time=' + sys_get_time();
			var parm = {
				'email' : email,
				'pwd' : pwd
			};
			$.ajax({
				type : 'POST',
				url : url,
				data : parm,
				success : function(result) {
					if ('success' == result) {
						 $.cookie('email', email, {expires:365});
						 $.cookie('pwd', pwd, {expires:365});
						location.href = '${contextPath}mobileMain.html';
					} else if ('not_find' == result)
						alert('未找到该用户！');
					else if ('pwd_error')
						alert('密码错误！');
					else if ('parameter_error' == result)
						alert('参数错误，请刷新页面后重试');
					else if ('email_or_pwd_error' == result)
						alert('邮箱或密码错误');
					else if ('no_any_rights' == result)
						alert('管理员还未给您赋予任何角色，请联系管理员');
					else if ('deleted' == result)
						alert('您已经被管理员禁用，请联系管理员');
					else
						alert('服务器错误');
				},
				error : function(e) {
					alert('服务器错误');
				}
			});
		}

	});
</script>
</html>


